<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
    <script src="./lib/babel.min.js"></script>
</head>

<body>
    <div id="root"></div>
    <script type="text/babel">
        // 1- 属性来自于父级（父组件）
    // 2- 父级是通过在调用子级（子组件）增加属性来传递的，比如
    //    <Child a={1} b={2}/>
    // 3- 子组件接收： this.props.a   this.props.b

    class App extends React.Component{
        render(){
            return(
                <Child userName={'zhangsan'} age={22}/>
            )
        }
    }

    class Child extends React.Component{
        render(){
            return(
                <div>
                    <p>{this.props.userName}</p>    
                    <p>{this.props.age}</p>    
                </div>
            )
        }
    }
    
    
    ReactDOM.createRoot(document.querySelector('#root')).render(<App/>)
    
    
    /* console.log(typeof App);//function

    const arr = [7, 1, 4, 3, 2];                   
    for (const elem of arr) { 
        setTimeout(() => console.log(elem), elem);
     } */
    </script>
</body>

</html>